<?php
namespace Shop\Controller;

use Common\Controller\AppframeController;

class UploadController extends AppframeController
{

    public function upload()
    {
        $upload = new \Think\Upload(); // 实例化上传类
        $upload->maxSize = 3145728000000; // 设置附件上传大小
        $upload->exts = array(
            'jpg',
            'gif',
            'png',
            'jpeg'
        ); // 设置附件上传类型
        $upload->rootPath = "./data/upload/";
        $upload->savePath = "/save/"; // 设置附件上传目录
                                      // 上传文件
        $info = $upload->upload();
       if (! $info) { // 上传错误提示错误信息
            $this->error($upload->getError());
        } else { // 上传成功
            $this->success('上传成功！');
        }
    }
}